package io.netty.handler.ssl;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.X509TrustManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SMTrustManager implements X509TrustManager {

	private static final Logger logger = LoggerFactory.getLogger(SMTrustManager.class);

	private X509Certificate[] trustCerts;

	public SMTrustManager(X509Certificate[] trustCerts) {
		this.trustCerts = trustCerts;
	}

	@Override
	public void checkClientTrusted(X509Certificate[] certificates, String auth) throws CertificateException {
		// Here: Add additional certificate validation logic
		logger.info("checkClientTrusted trustCertsLength=", trustCerts.length);
	}

	@Override
	public void checkServerTrusted(X509Certificate[] certificates, String auth) throws CertificateException {
		// Here: Add additional certificate validation logic
		logger.info("checkServerTrusted trustCertsLength=", trustCerts.length);
	}

	@Override
	public X509Certificate[] getAcceptedIssuers() {
		return null;
	}
}
